home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / listx / mlistsrt.ctl < prev    next >
Encoding:
Text File  |  1997-11-12  |  2.8 KB  |  96 lines

  1. VERSION 5.00
  2. Object = "{9FE255D1-F32E-11D0-9E15-444553540000}#1.0#0"; "MLISTX.OCX"
  3. Begin VB.UserControl MListSrt 
  4.    ClientHeight    =   3600
  5.    ClientLeft      =   0
  6.    ClientTop       =   0
  7.    ClientWidth     =   4800
  8.    ScaleHeight     =   3600
  9.    ScaleWidth      =   4800
  10.    Begin MabryCtl.MList MList1 
  11.       Height          =   2775
  12.       Left            =   840
  13.       TabIndex        =   0
  14.       Top             =   240
  15.       Width           =   2415
  16.       _ExtentX        =   4260
  17.       _ExtentY        =   4895
  18.       Object.TabStop         =   -1  'True
  19.       MousePointer    =   -1163005939
  20.       ColRowOrder     =   -1  'True
  21.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  22.          Name            =   "MS Sans Serif"
  23.          Size            =   8.25
  24.          Charset         =   0
  25.          Weight          =   400
  26.          Underline       =   0   'False
  27.          Italic          =   0   'False
  28.          Strikethrough   =   0   'False
  29.       EndProperty
  30.       BeginProperty Columns {23BAA6DE-05A6-11D1-9E15-0020AFD6A9D5} 
  31.          ColumnCount     =   1
  32.          BeginProperty Column0 {23BAA6E0-05A6-11D1-9E15-0020AFD6A9D5} 
  33.             Object.Width           =   0
  34.             MinWidth        =   0
  35.             MaxWidth        =   -1
  36.             UserResizeEnabled=   -1
  37.             Heading         =   "foo"
  38.             Object.Visible         =   -1
  39.             ColumnAlignment =   0
  40.             HeadingAlignment=   0
  41.          EndProperty
  42.       EndProperty
  43.    End
  44. End
  45. Attribute VB_Name = "MListSrt"
  46. Attribute VB_GlobalNameSpace = False
  47. Attribute VB_Creatable = True
  48. Attribute VB_PredeclaredId = False
  49. Attribute VB_Exposed = False
  50. Option Explicit
  51. Implements IMSort
  52.  
  53. Private m_NumericSort As Boolean
  54.  
  55. Public Property Let NumericSort(fNumeric As Boolean)
  56.    m_NumericSort = fNumeric
  57.    '
  58.    ' toggle property to force resort
  59.    '
  60.    MList1.Sorted = False
  61.    MList1.Sorted = True
  62. End Property
  63.  
  64. Public Property Get NumericSort() As Boolean
  65.    NumericSort = m_NumericSort
  66. End Property
  67.  
  68. Public Property Get ListCtl() As MList
  69.    Set ListCtl = MList1
  70. End Property
  71.  
  72. Private Function IMSort_CompareColumns(ByVal Str1 As String, ByVal Str2 As String, ByVal Column As Integer) As Integer
  73.    '
  74.    ' Compare items either as integer or string
  75.    '
  76.    If (m_NumericSort = True) Then
  77.       IMSort_CompareColumns = CInt(Str1) - CInt(Str2)
  78.    Else
  79.       If (Str1 < Str2) Then
  80.          IMSort_CompareColumns = -1
  81.       ElseIf (Str1 > Str2) Then
  82.          IMSort_CompareColumns = 1
  83.       Else
  84.          IMSort_CompareColumns = 0
  85.       End If
  86.    End If
  87. End Function
  88.  
  89. Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
  90.    MList1.Columns(0).SortObject = Me
  91. End Sub
  92.  
  93. Private Sub UserControl_Resize()
  94.    MList1.Move 0, 0, UserControl.ScaleWidth, UserControl.ScaleHeight
  95. End Sub
  96.